home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / TOS_SRC / CONTROL.STE / CTRL.C < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-10  |  31.6 KB  |  1,099 lines

  1. /*********************************************************************/
  2. /* CONTROL PANEL                              */
  3. /*    started 4/1/85 R.Z.   Copyright ATARI Corp. 1985         */
  4. /*     Clawed back to life after multiple anonymous butchers ..     */
  5. /*    No Gaurantees for Nationalities beyond FRENCH.             */
  6. /*        3/6/89  R.Z.                         */
  7. /*********************************************************************/
  8.  
  9. /*********************************************************************/
  10. /* INCLUDE FILES                             */
  11. /*********************************************************************/
  12.  
  13. #include "obdefs.h"
  14. #include "define.h"
  15. #include "gemdefs.h"
  16. #include "osbind.h"
  17.  
  18. /*********************************************************************/
  19. /* INTERNATIONAL VERSION FLAGS                         */
  20. /*********************************************************************/
  21.  
  22. #define    USA    TRUE
  23. #define    UK    FALSE
  24. #define    GERMAN    FALSE
  25. #define    ITALY    FALSE
  26. #define    FRENCH    FALSE
  27.  
  28. #define    SPAIN    FALSE
  29. #define    SWEDEN    FALSE
  30. #define FINLAND    FALSE
  31. #define NORWAY    FALSE    /* NORWEGIAN translation NOV. 1987 J.P. */
  32. #define    TURKEY    FALSE
  33. #define DENMARK FALSE    /* Last updated 1/7/88 J.P. */
  34. #define ARABIC    FALSE    /* The Mad Arab .. 2/23/88  A.A. */
  35.  
  36. /*********************************************************************/
  37. /* RESOURCE FILE                             */
  38. /*********************************************************************/
  39.  
  40. #include "ctrl.rsc"
  41.  
  42. /*********************************************************************/
  43. /* DEFINES                                    */
  44. /*********************************************************************/
  45.  
  46. #define WI_KIND    (NAME | CLOSER | MOVER)    /* window kind */
  47.  
  48. #define CR    13
  49.  
  50. #define OLD    0
  51. #define NEW    1
  52. #define ST_COLOR 0
  53. #define ST_MOUSE 48
  54. #define ST_BELL 49
  55. #define ST_CLICK 50
  56. #define ST_IRPT 51
  57. #define ST_KRPT 52
  58. #define NUM_STATES 53
  59.  
  60. #define NO_WINDOW (-1)
  61. #define    REDRAW        1
  62.  
  63. #define    FAT    (0x020000L)
  64.  
  65. #define RMIX_POS (ctrl_objs[RMIX_SL].ob_y)
  66. #define GMIX_POS (ctrl_objs[GMIX_SL].ob_y)
  67. #define BMIX_POS (ctrl_objs[BMIX_SL].ob_y)
  68. #define IRPT_POS (ctrl_objs[IRPT_SL].ob_x)
  69. #define KRPT_POS (ctrl_objs[KRPT_SL].ob_x)
  70. #define IIMG_POS (ctrl_objs[IRPT_MG].ob_x)
  71. #define KIMG_POS (ctrl_objs[KRPT_MG].ob_x)
  72.  
  73. #define BUFSIZE    128
  74. #define NEWMSG    99
  75.  
  76. /*********************************************************************/
  77. /* EXTERNALS                                    */
  78. /*********************************************************************/
  79.  
  80. extern int    gl_apid;
  81. extern int    donoise();
  82. extern int    set_state();
  83. extern int    val_slider();
  84.  
  85. /*********************************************************************/
  86. /* GLOBAL VARIABLES                                */
  87. /*********************************************************************/
  88.  
  89. int    gl_xclip;
  90. int    gl_yclip;
  91. int    gl_wclip;
  92. int    gl_hclip;
  93. int    gl_hchar;
  94. int    gl_wchar;
  95. int    gl_wbox;
  96. int    gl_hbox;
  97.  
  98. int     ctrl_id ;    /* control id */
  99. int     prtr_id ;    /* printer id */
  100.  
  101. int     phys_handle;    /* physical workstation handle */
  102. int     handle;        /* virtual workstation handle */
  103. int    wi_handle;    /* window handle */
  104. int    top_window;    /* handle of topped window */
  105. int    msgbuff[8];    /* event message buffer */
  106. int    ret;        /* dummy return variable */
  107. int    xdesk,ydesk,hdesk,wdesk;
  108. int    xwind,ywind,hwind,wwind;
  109. int    xwork,ywork,hwork,wwork;
  110. int    mx,my;
  111. int    num_colors;    /* number of colors in the current mode */
  112.  
  113. int    contrl[11];
  114. int    intin[128];
  115. int    ptsin[128];
  116. int    intout[128];
  117. int    ptsout[128];
  118. int    work_in[11];    /* Input to GSX parameter array */
  119. int     work_out[57];    /* Output from GSX parameter array */
  120. int    pxyarray[10];    /* input point array */
  121.  
  122. int    rgb[3];        /* temporary array for GSX color commands */
  123. int    butdown;    /* button state tested for, UP/DOWN */
  124. int     color;        /* active color register */
  125. int    year,month,day,hour,minute;    /* current date values */
  126.  
  127. int     state[2][NUM_STATES];        /* control panel state, old & new */
  128. int    rmix_val,gmix_val,bmix_val;    /* individual mixer values */
  129.  
  130. int    mix_max;    /* Maximum Color mixer value (7 or 15) */
  131. int    mix_high;    /* Height of a mixer step (142 or 66) */
  132. int    mix_slot;    /* Length of a shade (125 or 62) */
  133.  
  134. int    prtr_hi;    /* changeable shadow for PRTR_HI */
  135. int    ctrl_hi;    /* changeable shadow for CTRL_HI */
  136.  
  137. char    config[6];
  138. char    buffer[BUFSIZE];    /* buffer for Shell-get */
  139. int    keycode;        /* keycode returned by event-keyboard */
  140.  
  141. char    baudvar;    /* baud number selected */
  142. char    rsave[6];    /* 9600, full, no parity, 8 bits, none */    
  143.  
  144. #if ARABIC
  145. char    *baudstr[] = { "õ¨Øãã","¨Àãã","œÕãã","øÀãã","Øœãã","Øããã","õÕãã",
  146.                         "õØãã","Àãã","øãã","Øãã","õŒã","õøœ","õõã","ÃŒ","Œã"};
  147. #else
  148. char    *baudstr[] = { "19200","9600","4800","3600","2400","2000","1800",
  149.             "1200","600","300","200","150","134","110","75","50"};
  150. #endif
  151.  
  152. char    remap[] = {4,0,1,5,6,7,8,2,9,3,10,11,12,13,14,15};
  153. char    remap2[] = {1,2,7,9,0,3,4,5,6,8,10,11,12,13,14,15};
  154.  
  155. /****************************************************************/
  156. /*  GSX UTILITY ROUTINES.                    */
  157. /****************************************************************/
  158. /* open virtual workstation                    */
  159. /****************************************************************/
  160. open_vwork()
  161. {
  162. int i;
  163.     for(i=0;i<10;work_in[i++]=1);
  164.     work_in[10]=2;
  165.     handle=phys_handle;
  166.     v_opnvwk(work_in,&handle,work_out);
  167.     num_colors = work_out[13];
  168.     if(work_out[39] <= 512) {
  169.         mix_max=7;
  170.         mix_high=142;
  171.         mix_slot=125; }
  172.     else {
  173.         mix_max=15;
  174.         mix_high=66;
  175.         mix_slot=62; }
  176. }
  177.  
  178. /****************************************************************/
  179. /* open window                            */
  180. /****************************************************************/
  181. open_window()
  182. {
  183.     wi_handle=wind_create(WI_KIND,xdesk,ydesk,wdesk,hdesk);
  184.  
  185. #if USA | UK | ITALY
  186.     wind_set(wi_handle, WF_NAME," CONTROL PANEL ", 0, 0);
  187. #endif
  188. #if GERMAN
  189.     wind_set(wi_handle, WF_NAME," KONTROLLFELD ", 0, 0);
  190. #endif
  191. #if FRENCH
  192.     wind_set(wi_handle, WF_NAME," PANNEAU CONTROLE ", 0, 0);
  193. #endif
  194. #if SPAIN
  195.     wind_set(wi_handle, WF_NAME," PANEL DE CONTROL ", 0, 0);
  196. #endif
  197. #if TURKEY
  198.     wind_set(wi_handle, WF_NAME," KONTROL PANEL\235 ", 0, 0);
  199. #endif
  200. #if SWEDEN
  201.     wind_set(wi_handle, WF_NAME," INST\216LLNINGAR ", 0, 0);
  202. #endif
  203. #if FINLAND
  204.     wind_set(wi_handle, WF_NAME," S\204\204timet ", 0, 0);
  205. #endif
  206. #if NORWAY
  207.     wind_set(wi_handle, WF_NAME," Kontrollfelt ", 0, 0);
  208. #endif
  209. #if DENMARK
  210.     wind_set(wi_handle, WF_NAME," Kontrolpanel ", 0, 0);
  211. #endif
  212. #if ARABIC
  213.         wind_set(wi_handle, WF_NAME," ±³שהבתIJ ⌡³הףת ", 0, 0);
  214. #endif
  215.  
  216.     wind_calc(WC_BORDER,WI_KIND,xdesk,ydesk,CTRL_WID,ctrl_hi,&xwind,&ywind,&wwind,&hwind);
  217.  
  218.     xwind+=(wdesk-wwind)/2;
  219.     ywind+=(hdesk-hwind+16+4)/2;    /* RMS 4 to center on screen rs232 button */
  220.  
  221.     wind_open(wi_handle,xwind,ywind,wwind,hwind);
  222.     graf_growbox(xwind+wwind/2,ywind+hwind/2,36,36,xwind,ywind,wwind,hwind);
  223. }
  224.  
  225. /****************************************************************/
  226. /* find and redraw all clipping rectangles            */
  227. /****************************************************************/
  228. do_redraw(object,xc,yc,wc,hc)
  229. int object,xc,yc,wc,hc;
  230. {
  231. int x,y,w,h;
  232. GRECT t1,t2;
  233.  
  234.     wind_get(wi_handle,WF_FIRSTXYWH,&x,&y,&w,&h);
  235.     t2.g_x=xc;
  236.     t2.g_y=yc;
  237.     t2.g_w=wc;
  238.     t2.g_h=hc;
  239.     while (w && h) {
  240.       t1.g_x=x;
  241.       t1.g_y=y;
  242.       t1.g_w=w;
  243.       t1.g_h=h;
  244.       if (rc_intersect(&t2,&t1))
  245.         objc_draw(ctrl_objs,object,MAX_DEPTH,t1.g_x,t1.g_y,t1.g_w,t1.g_h);
  246.       wind_get(wi_handle,WF_NEXTXYWH,&x,&y,&w,&h);
  247.     }
  248.     pxyarray[0]=xwork;
  249.     pxyarray[1]=ywork;
  250.     pxyarray[2]=xwork+wwork-1;
  251.     pxyarray[3]=ywork+hwork-1;
  252.     vs_clip(handle,1,pxyarray);    /* set clipping */
  253. }
  254.  
  255.  
  256.  
  257. /****************************************************************/
  258. /* Sends the rs232 configuration to the vt52            */
  259. /* via the aes message (pipe?) system.                */
  260. /****************************************************************/
  261. send_msg()
  262. {
  263. int    id,i;
  264.  
  265.     id = appl_find("EMULATOR");
  266.  
  267.     if(id != -1) {        /* there is a vt52 out there */
  268.         msgbuff[0] = NEWMSG;
  269.         for(i=0; i<=STBIT; i++) msgbuff[i+1] = rsave[i];
  270.         appl_write(id,16,msgbuff);
  271.         }
  272. }
  273.  
  274. /****************************************************************/
  275. /*        Accessory Init. Until First Event_Multi        */
  276. /****************************************************************/
  277. main()
  278. {
  279. int i;
  280.  
  281.     appl_init();
  282.     phys_handle=graf_handle(&gl_wchar,&gl_hchar,&gl_wbox,&gl_hbox);
  283.  
  284.     prtr_hi=PRTR_HI;
  285.     ctrl_hi=CTRL_HI;
  286.  
  287.     if(gl_hchar>8){                /* HIGH RES */
  288.         for(i=1;i<NUM_POBJS;i++){    /* adjust printer rsc */
  289.             prnt_objs[i].ob_y *= 2;
  290.             prnt_objs[i].ob_height *= 2;
  291.         }
  292.         for(i=0;i<NUM_RSOBJ;i++) {     /* adjust rs232 configure rsc */
  293.                rs_objs[i].ob_height *= 2;
  294.                rs_objs[i].ob_y *= 2;
  295.         }
  296.         ctrl_objs[PRINTER].ob_height *=2; /* adjust printer button */
  297.         prtr_hi *= 2;
  298.         ctrl_objs[RS232].ob_height *=2;   /* adjust rs232 button */
  299.         ctrl_hi += gl_hchar;          /* adj height */
  300.     }
  301.  
  302.     ctrl_objs[CROOT].ob_height=ctrl_hi;  /* set panel height */
  303.     prnt_objs[CROOT].ob_height=prtr_hi;
  304.  
  305.     if(ctrl_obj[RMIX_SL].ob_height < gl_hchar)     /* text too large...   */
  306.     {                           /* so switch to smaller*/
  307.         ctrl_objs[RMIX_SL].ob_spec->te_font = 5;   /* font*/
  308.         ctrl_objs[GMIX_SL].ob_spec->te_font = 5;
  309.         ctrl_objs[BMIX_SL].ob_spec->te_font = 5;
  310.         ctrl_objs[RTOP].ob_spec->te_font = 5;
  311.         ctrl_objs[GTOP].ob_spec->te_font = 5;
  312.         ctrl_objs[BTOP].ob_spec->te_font = 5;
  313.         ctrl_objs[RBOT].ob_spec->te_font = 5;
  314.         ctrl_objs[GBOT].ob_spec->te_font = 5;
  315.         ctrl_objs[BBOT].ob_spec->te_font = 5;
  316.     }
  317.  
  318.  
  319. #if USA | UK
  320.     ctrl_id=menu_register(gl_apid,"  Control Panel");
  321. #endif
  322. #if GERMAN
  323.     ctrl_id=menu_register(gl_apid,"  Kontrollfeld");
  324. #endif
  325. #if ITALY
  326.     ctrl_id=menu_register(gl_apid,"  Control Panel");
  327. #endif
  328. #if FRENCH
  329.     ctrl_id=menu_register(gl_apid,"  Panneau Controle");
  330. #endif
  331. #if SPAIN
  332.     ctrl_id=menu_register(gl_apid,"  Panel de Control");
  333. #endif
  334. #if TURKEY
  335.     ctrl_id=menu_register(gl_apid,"  Kontrol Paneli");
  336. #endif
  337. #if SWEDEN
  338.     ctrl_id=menu_register(gl_apid,"  Inst\204llningar");
  339. #endif
  340. #if FINLAND
  341.     ctrl_id=menu_register(gl_apid,"  S\204\204timet");
  342. #endif
  343. #if NORWAY
  344.     ctrl_id=menu_register(gl_apid,"  Kontrollfelt");
  345. #endif
  346. #if DENMARK
  347.     ctrl_id=menu_register(gl_apid,"  Kontrolpanel");
  348. #endif
  349. #if ARABIC
  350.         ctrl_id=menu_register(gl_apid,"  ±³שהבתIJ ⌡³הףת");
  351. #endif
  352.  
  353.     wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk);
  354.     wi_handle = NO_WINDOW;    /* accessory not opened yet */
  355.     butdown=TRUE;
  356.     color=0;
  357.  
  358.     open_vwork();
  359.     read_in();        /* read in desktop.inf */
  360.     set_up();        /* read & implement default settings */
  361.  
  362.     v_clsvwk(handle);
  363.     set_bios();
  364.         set_state();        /* jam MS RS232 values into hardware */
  365.     multi();
  366. }
  367.  
  368. /****************************************************************/
  369. /* dispatches all accessory tasks                */
  370. /****************************************************************/
  371. multi()
  372. {
  373. int event,obj_over;
  374. int i,temp;
  375. int x,y,w,h;
  376.  
  377.       while (TRUE) {
  378.     event = evnt_multi(MU_MESAG | MU_BUTTON | MU_TIMER | MU_KEYBD,
  379.             1,1,butdown,
  380.             0,0,0,0,0,
  381.             0,0,0,0,0,
  382.             msgbuff,30000,0,&mx,&my,&ret,&ret,&keycode,&ret);
  383.  
  384.     wind_update(TRUE);        /* Lowell sez */
  385.  
  386.     wind_get(wi_handle,WF_TOP,&top_window,&ret,&ret,&ret);
  387.  
  388.     if (event & MU_TIMER){
  389.         get_time();        /* get  GEMDOS time/date */
  390.         show_time();
  391.         if(wi_handle == top_window){
  392.            objc_draw(ctrl_objs, TIME, 1,xwork,ywork,wwork,hwork);
  393.            objc_draw(ctrl_objs, DATE, 1,xwork,ywork,wwork,hwork);
  394.         }else
  395.            if(wi_handle != NO_WINDOW){
  396.             do_redraw(TIME,xwork+ctrl_objs[TIME].ob_x,ywork+ctrl_objs[TIME].ob_y,ctrl_objs[TIME].ob_width,ctrl_objs[TIME].ob_height);
  397.             do_redraw(DATE,xwork+ctrl_objs[DATE].ob_x,ywork+ctrl_objs[DATE].ob_y,ctrl_objs[DATE].ob_width,ctrl_objs[DATE].ob_height);
  398.            }
  399.     }
  400.  
  401.     if (event & MU_MESAG)
  402.       switch (msgbuff[0]) {
  403.  
  404.       case NEWMSG:        /* vt52 calling in */
  405.         for(i=0; i<=STBIT; i++)    rsave[i] = (char) msgbuff[i+1];
  406.         baudvar = remap2[rsave[BAUD]];    /* init baud variable */
  407.         break;
  408.  
  409.       case WM_REDRAW:
  410.         if (msgbuff[3] == wi_handle)
  411.           do_redraw(0,msgbuff[4],msgbuff[5],msgbuff[6],msgbuff[7]);
  412.         break;
  413.  
  414.       case WM_NEWTOP:
  415.       case WM_TOPPED:
  416.         if (msgbuff[3] == wi_handle){
  417.           wind_set(wi_handle,WF_TOP,0,0,0,0);
  418.         }
  419.         break;
  420.  
  421.       case AC_CLOSE:
  422.         if((msgbuff[3] == ctrl_id)&&(wi_handle != NO_WINDOW)){
  423.           out_control();
  424.           v_clsvwk(handle);
  425.           wi_handle = NO_WINDOW;
  426.         }
  427.         break;
  428.  
  429.       case WM_CLOSED:
  430.         if(msgbuff[3] == wi_handle){
  431.           out_control();
  432.           wind_close(wi_handle);
  433.           graf_shrinkbox(xwork+wwork/2,ywork+hwork/2,gl_wbox,gl_hbox,xwork,ywork,wwork,hwork);
  434.           wind_delete(wi_handle);
  435.           v_clsvwk(handle);
  436.           wi_handle = NO_WINDOW;
  437.         }
  438.         break;
  439.  
  440.       case WM_MOVED:
  441.         if(msgbuff[3] == wi_handle){
  442.           wind_set(wi_handle,WF_CURRXYWH,msgbuff[4],msgbuff[5],msgbuff[6],msgbuff[7]);
  443.           wind_get(wi_handle,WF_WORKXYWH,&xwork,&ywork,&wwork,&hwork);
  444.           ctrl_objs[ROOT].ob_x = xwork;
  445.           ctrl_objs[ROOT].ob_y = ywork;
  446.         }
  447.         break;
  448.  
  449.       case AC_OPEN:
  450.         if (msgbuff[4] == ctrl_id){
  451.           set_state();        /* jam MS RS232 values into hardware */
  452.           if(wi_handle == NO_WINDOW){
  453.         open_vwork();
  454.         set_up();
  455.         get_time();
  456.         show_time();
  457.             open_window();
  458.             wind_get(wi_handle,WF_WORKXYWH,&xwork,&ywork,&wwork,&hwork);
  459.             ctrl_objs[ROOT].ob_x = xwork;
  460.             ctrl_objs[ROOT].ob_y = ywork;
  461.           }
  462.           else    /* if already opened, for user convenience */
  463.             wind_set(wi_handle,WF_TOP,0,0,0,0);
  464.         }
  465.  
  466.       } /* switch (msgbuff[0]) */
  467.  
  468.     if ((event & MU_BUTTON)&&(wi_handle == top_window))
  469.       if(butdown)
  470.        switch(obj_over = objc_find(ctrl_objs, 0, MAX_DEPTH, mx, my)){
  471.        case RMIX_SL:
  472.         rmix_val = min(((1000 - graf_slidebox(ctrl_objs,RMIX,RMIX_SL,1))/mix_slot),mix_max);
  473.         do_slider(rmix_val,RMIX,rmix_str,&RMIX_POS);
  474.         setcolor();
  475.         break;
  476.        case GMIX_SL:
  477.         gmix_val = min(((1000 - graf_slidebox(ctrl_objs,GMIX,GMIX_SL,1))/mix_slot),mix_max);
  478.         do_slider(gmix_val,GMIX,gmix_str,&GMIX_POS);
  479.         setcolor();
  480.         break;
  481.        case BMIX_SL:
  482.         bmix_val = min(((1000 - graf_slidebox(ctrl_objs,BMIX,BMIX_SL,1))/mix_slot),mix_max);
  483.         do_slider(bmix_val,BMIX,bmix_str,&BMIX_POS);
  484.         setcolor();
  485.         break;
  486.        case RBOT:
  487.         rmix_val = max((rmix_val - 1),0);
  488.         do_slider(rmix_val,RMIX,rmix_str,&RMIX_POS);
  489.         setcolor();
  490.         butdown = FALSE;
  491.         break;
  492.        case RTOP:
  493.         rmix_val = min((rmix_val + 1),mix_max);
  494.         do_slider(rmix_val,RMIX,rmix_str,&RMIX_POS);
  495.         setcolor();
  496.         butdown = FALSE;
  497.         break;
  498.        case GBOT:
  499.         gmix_val = max((gmix_val - 1),0);
  500.         do_slider(gmix_val,GMIX,gmix_str,&GMIX_POS);
  501.         setcolor();
  502.         butdown = FALSE;
  503.         break;
  504.        case GTOP:
  505.         gmix_val = min((gmix_val + 1),mix_max);
  506.         do_slider(gmix_val,GMIX,gmix_str,&GMIX_POS);
  507.         setcolor();
  508.         butdown = FALSE;
  509.         break;
  510.        case BBOT:
  511.         bmix_val = max((bmix_val - 1),0);
  512.         do_slider(bmix_val,BMIX,bmix_str,&BMIX_POS);
  513.         setcolor();
  514.         butdown = FALSE;
  515.         break;
  516.        case BTOP:
  517.         bmix_val = min((bmix_val + 1),mix_max);
  518.         do_slider(bmix_val,BMIX,bmix_str,&BMIX_POS);
  519.         setcolor();
  520.         butdown = FALSE;
  521.         break;
  522.        case IRPT_MG:
  523.        case IRPT_SL:
  524.         set_rept((horz_slider(IRPT,IRPT_BX,IRPT_SL,&IRPT_POS,&IIMG_POS)/22+1),state[NEW][ST_KRPT]);
  525.         break;
  526.        case KRPT_SL:
  527.        case KRPT_MG:
  528.         set_rept(state[NEW][ST_IRPT],(horz_slider(KRPT,KRPT_BX,KRPT_SL,&KRPT_POS,&KIMG_POS)/50+1));
  529.         break;
  530.        case MBOX0:
  531.        case MBOX1:
  532.        case MBOX2:
  533.        case MBOX3:
  534.        case MBOX4:
  535.         for(i=MBOX0; i<=MBOX4; i++)
  536.           if(ctrl_objs[i].ob_state & SELECTED)
  537.            objc_change(ctrl_objs,i,0,xwork,ywork,wwork,hwork,NORMAL,1);
  538.         objc_change(ctrl_objs,obj_over,0,xwork,ywork,wwork,hwork,SELECTED,1);
  539.         state[NEW][ST_MOUSE]=obj_over-MBOX0;
  540.         evnt_dclick(obj_over-MBOX0,1);
  541.         butdown = FALSE;
  542.         break;
  543.        case DATE:
  544.        case TIME:
  545.         if(graf_watchbox(ctrl_objs,obj_over,SELECTED,NORMAL)){
  546.           form_do(ctrl_objs,obj_over);
  547.           objc_change(ctrl_objs,TIME,0,xwork,ywork,wwork,hwork,NORMAL,1);
  548.           objc_change(ctrl_objs,DATE,0,xwork,ywork,wwork,hwork,NORMAL,1);
  549.           set_time();
  550.           get_time();
  551.           show_time();
  552.           objc_draw(ctrl_objs, TIME, 1,xwork,ywork,wwork,hwork);
  553.           objc_draw(ctrl_objs, DATE, 1,xwork,ywork,wwork,hwork);
  554.         }
  555.         break;
  556.        case CLICK:
  557.         state[NEW][ST_CLICK] ^= 1;
  558.         set_noise();
  559.         objc_draw(ctrl_objs, CLICK_BX, 1,xwork,ywork,wwork,hwork);
  560.         butdown = FALSE;
  561.         break;
  562.        case BELL:
  563.         state[NEW][ST_BELL] ^= 1;
  564.         set_noise();
  565.         objc_draw(ctrl_objs, BELL_BX, 1,xwork,ywork,wwork,hwork);
  566.         butdown = FALSE;
  567.         break;
  568.        case CANCEL:
  569.         if(graf_watchbox(ctrl_objs,obj_over,SELECTED,NORMAL)){
  570.           set_up();
  571.           ctrl_objs[CANCEL].ob_state=NORMAL;
  572.           do_redraw(0,xwork,ywork,wwork,hwork);
  573.         }
  574.         break;
  575.        case CLR0:
  576.        case CLR1:
  577.        case CLR2:
  578.        case CLR3:
  579.        case CLR4:
  580.        case CLR5:
  581.        case CLR6:
  582.        case CLR7:
  583.        case CLR8:
  584.        case CLR9:
  585.        case CLRA:
  586.        case CLRB:
  587.        case CLRC:
  588.        case CLRD:
  589.        case CLRE:
  590.        case CLRF:
  591.         color= obj_over - CLR0;
  592.         vq_color(handle,color,1,rgb);
  593.         rmix_val = rgb[0]/mix_high;
  594.         do_slider(rmix_val,RMIX,rmix_str,&RMIX_POS);
  595.         gmix_val = rgb[1]/mix_high;
  596.         do_slider(gmix_val,GMIX,gmix_str,&GMIX_POS);
  597.         bmix_val = rgb[2]/mix_high;
  598.         do_slider(bmix_val,BMIX,bmix_str,&BMIX_POS);
  599.         for(temp=CLR1; temp<=CLRF;temp++)
  600.            if(!(ctrl_objs[temp].ob_spec & FAT)){
  601.             ctrl_objs[temp].ob_spec ^= FAT;
  602.             objc_draw(ctrl_objs, temp, MAX_DEPTH,xwork,ywork,wwork,hwork);
  603.            };
  604.         if(ctrl_objs[CLR0].ob_x == ctrl_objs[CLR1].ob_x){
  605.            ctrl_objs[CLR0].ob_spec &= 0xff0fffL;
  606.            objc_draw(ctrl_objs,CLR0,MAX_DEPTH,xwork,ywork,wwork,hwork);
  607.            ctrl_objs[CLR0].ob_x += 3;
  608.            ctrl_objs[CLR0].ob_y += 3;
  609.            ctrl_objs[CLR0].ob_width -= 6;
  610.            ctrl_objs[CLR0].ob_height  -= 6;
  611.            ctrl_objs[CLR0].ob_spec |= 0x01000L;
  612.            objc_draw(ctrl_objs,CLR0,MAX_DEPTH,xwork,ywork,wwork,hwork);
  613.         }
  614.         if(color) ctrl_objs[obj_over].ob_spec ^= FAT;
  615.         else {
  616.            ctrl_objs[CLR0].ob_x=ctrl_objs[CLR1].ob_x;
  617.            ctrl_objs[CLR0].ob_y=ctrl_objs[CLR2].ob_y;
  618.            ctrl_objs[CLR0].ob_width=ctrl_objs[CLR1].ob_width;
  619.            ctrl_objs[CLR0].ob_height=ctrl_objs[CLR1].ob_height;
  620.         }
  621.         objc_draw(ctrl_objs, obj_over, MAX_DEPTH,xwork,ywork,wwork,hwork);
  622.         butdown = FALSE;
  623.         break;
  624.  
  625.     case RS232:
  626.         ctrl_objs[RS232].ob_state=SELECTED;
  627.         objc_draw(ctrl_objs,RS232,0,xwork,ywork,wwork,hwork);
  628.         rsconfig();
  629.         ctrl_objs[RS232].ob_state=NORMAL;
  630.         objc_draw(ctrl_objs,RS232,0,xwork,ywork,wwork,hwork);
  631.       break;
  632.     case PRINTER:
  633.         ctrl_objs[PRINTER].ob_state=SELECTED;
  634.         objc_draw(ctrl_objs,PRINTER,0,xwork,ywork,wwork,hwork);
  635.         set_bios();
  636.         for(i=1;i<NUM_POBJS;prnt_objs[i++].ob_state=NORMAL);
  637.         for(i=0;i<6;i++)
  638.           prnt_objs[(config[i] + 8) + 3*i].ob_state=SELECTED;
  639.         form_center(prnt_objs,&x,&y,&w,&h);
  640.         prnt_objs[ROOT].ob_x = x+3;
  641.         prnt_objs[ROOT].ob_y = y+3;
  642.         form_dial(FMD_START,0,0,36,36,x,y,w,h);
  643.         form_dial(FMD_GROW,0,0,36,36,x,y,w,h);
  644.         objc_draw(prnt_objs, 0, MAX_DEPTH, x,y,w,h);
  645.         if(form_do(prnt_objs,0) == OK){
  646.            for(i=0;i<6;i++)
  647.              config[i]=(prnt_objs[8+3*i].ob_state & SELECTED) ? 0 : 1;
  648.            set_bios();
  649.            out_print();
  650.         }
  651.         form_dial(FMD_SHRINK,0,0,36,36,x,y,w,h);
  652.         form_dial(FMD_FINISH,0,0,36,36,x,y,w,h);
  653.         ctrl_objs[PRINTER].ob_state=NORMAL;
  654.         objc_draw(ctrl_objs,PRINTER,0,xwork,ywork,wwork,hwork);
  655.         break;
  656.        default:
  657.         butdown = FALSE;
  658.         break;
  659.        } /* switch (objc_find) */
  660.       else butdown = TRUE;
  661.  
  662.  
  663.       if((event & MU_KEYBD)&&((keycode & 0xff)==CR)){
  664.          set_up();
  665.          do_redraw(0,xwork,ywork,wwork,hwork);
  666.       }
  667.     
  668.     wind_update(FALSE);        /* Lowell sez */
  669.  
  670.       } /* while (TRUE) */
  671.  
  672. }
  673.  
  674.  
  675. /****************************************************************/
  676. /* REPOSITION & REDRAW SLIDER                    */
  677. /****************************************************************/
  678. do_slider(newval,parent,string,pos)
  679. int parent,newval,*pos;
  680. char *string;
  681. {
  682.     val_slider(newval,string);
  683.     *pos = mul_div(((mix_max - newval) * (mix_high+1)),(HMIX-HSLDR),1000);
  684.     objc_draw(ctrl_objs,parent,MAX_DEPTH,xwork,ywork,wwork,hwork);
  685. }
  686. /****************************************************************/
  687. /* HORIZONTAL SLIDER                        */
  688. /****************************************************************/
  689. horz_slider(box,parent,slider,pos,imgpos)
  690. int box,parent,slider,*pos,*imgpos;
  691. {
  692. int temp;
  693.     temp = graf_slidebox(ctrl_objs,parent,slider,0);
  694.     *pos = *imgpos = mul_div(temp,(WRPT-WSLDR),1000);
  695.     objc_draw(ctrl_objs,box,MAX_DEPTH,xwork,ywork,wwork,hwork);
  696.     return(temp);
  697. }
  698.  
  699. /****************************************************************/
  700. /* SET A COLOR                            */
  701. /****************************************************************/
  702. setcolor()
  703. {
  704. int i;
  705.     rgb[0] = rmix_val*mix_high;
  706.     rgb[1] = gmix_val*mix_high;
  707.     rgb[2] = bmix_val*mix_high;
  708.     vs_color(handle,color,rgb);
  709.     for(i=0;i<3;i++) state[NEW][3*color+i]=rgb[i];
  710. }
  711.  
  712. /****************************************************************/
  713. /* Set desired keyboard repeat rates to BIOS.            */
  714. /****************************************************************/
  715. set_rept(initial,repeat)
  716. int initial,repeat;
  717. {
  718.     Kbrate(initial,repeat);        /* set kbrate */
  719.     state[NEW][ST_IRPT]=initial;
  720.     state[NEW][ST_KRPT]=repeat;
  721. }
  722.  
  723. /****************************************************************/
  724. /* Get current time/date from GEMDOS.                */
  725. /****************************************************************/
  726. get_time()
  727. {
  728. int temp;
  729.     temp=Tgettime();            /* get GEMDOS time */
  730.     minute= (0x03f & (temp >> 5));
  731.     hour= (0x01f & (temp >> 11));
  732.     temp=Tgetdate();            /* get GEMDOS date */
  733.     day= 0x01f & temp;
  734.     month= (0x0f & (temp >> 5));
  735.     year= ((0x07f & (temp >> 9))+80)%100;
  736. }
  737.  
  738. /****************************************************************/
  739. /* Convert time/date to displayed values.            */
  740. /****************************************************************/
  741. show_time()
  742. {
  743.  
  744. #if USA
  745.     my_itoa(&date[0],month,TRUE);
  746.     my_itoa(&date[2],day,TRUE);
  747.     my_itoa(&date[4],year,FALSE);
  748. #endif
  749. #if SWEDEN|FINLAND|ARABIC
  750.     my_itoa(&date[0],year,FALSE);
  751.     my_itoa(&date[2],month,FALSE);
  752.     my_itoa(&date[4],day,FALSE);
  753. #endif
  754. #if UK|GERMAN|FRENCH|ITALY|SPAIN|TURKEY|NORWAY|DENMARK
  755.     my_itoa(&date[0],day,TRUE);
  756.     my_itoa(&date[2],month,TRUE);
  757.     my_itoa(&date[4],year,FALSE);
  758. #endif
  759.  
  760. #if USA | UK
  761.     my_itoa(&time[2],minute,0);
  762.     if(hour) my_itoa(&time[0],((hour>12) ? hour-12 : hour),1);
  763.     else my_itoa(&time[0],12,1);
  764.     time[4] = (hour < 12) ? 'A' : 'P' ;
  765. #else
  766.     my_itoa(&time[2],minute,FALSE);
  767.     my_itoa(&time[0],hour,TRUE);
  768. #endif
  769. }
  770.  
  771. /****************************************************************/
  772. /* Set displayed date to IKBD and GEMDOS.            */
  773. /****************************************************************/
  774. set_time()
  775. {
  776. int miltime,ibmyr;
  777.  
  778. #if SWEDEN|FINLAND|ARABIC
  779.     ibmyr = my_atoi(&date[0]);
  780. #else
  781.     ibmyr = my_atoi(&date[4]);
  782. #endif
  783.  
  784.     ibmyr = (ibmyr<80) ? ibmyr+20 : ibmyr-80 ;
  785.     ibmyr = ibmyr << 9;
  786.  
  787. #if USA
  788.     ibmyr |= (my_atoi(&date[0]) & 15) << 5;    /* month */
  789.     ibmyr |= (my_atoi(&date[2]) & 31);    /* day */
  790. #endif
  791. #if UK|GERMAN|FRENCH|ITALY|SPAIN|TURKEY|NORWAY|DENMARK
  792.     ibmyr |= (my_atoi(&date[2]) & 15) << 5;    /* month */
  793.     ibmyr |= (my_atoi(&date[0]) & 31);    /* day */
  794. #endif
  795. #if SWEDEN|FINLAND|ARABIC
  796.     ibmyr |= (my_atoi(&date[2]) & 15) << 5;    /* month */
  797.     ibmyr |= (my_atoi(&date[4]) & 31);    /* day */
  798. #endif
  799.  
  800.     Tsetdate(ibmyr);            /* set GEMDOS date */
  801.     miltime = my_atoi(&time[0]) & 31;
  802.  
  803. #if USA | UK
  804.     if((time[4] == 'P') && (miltime < 12))miltime += 12;
  805.     if((time[4] == 'A') && (miltime == 12))miltime = 0;
  806. #endif
  807.  
  808.     miltime = (miltime << 11)|((my_atoi(&time[2])&63) << 5);
  809.     Tsettime(miltime);            /* set GEMDOS time */
  810.     Settime(((long)Tgetdate() << 16)|((long)Tgettime()));    /* set     IKBD time and date */
  811. }
  812.  
  813. #if ARABIC
  814. /****************************************************************/
  815. /* Converts values (0-99) to Arabic display chars               */
  816. /****************************************************************/
  817. my_itoa(ptr,val,suppress)
  818. int     val,suppress;
  819. char    *ptr;
  820. {
  821.         *ptr++ = (suppress && ((val/10) == 0)) ? ' ' : ((val/10) + 0xb0);
  822.         *ptr = (val%10) + 0xb0;
  823. }
  824.  
  825. /****************************************************************/
  826. /* Convert Arabic chars to digits.                              */
  827. /****************************************************************/
  828. my_atoi(ptr)
  829. char *ptr;
  830. {
  831. int temp;
  832.         temp = (*ptr == ' ') ? 0 : 10*(*ptr - 0xb0);
  833.         return(temp+(*++ptr - 0xb0));
  834. }
  835.  
  836. #else
  837.  
  838. /****************************************************************/
  839. /* Convert chars to digits.                    */
  840. /****************************************************************/
  841. my_atoi(ptr)
  842. char *ptr;
  843. {
  844. int temp;
  845.     temp = (*ptr == ' ') ? 0 : 10*(*ptr - '0');
  846.     return(temp+(*++ptr - '0'));
  847. }
  848.  
  849. /****************************************************************/
  850. /* Converts values (0-99) to display chars            */
  851. /****************************************************************/
  852. my_itoa(ptr,val,suppress)
  853. int    val,suppress;
  854. char    *ptr;
  855. {
  856.     *ptr++ = (suppress && ((val/10) == 0)) ? ' ' : ((val/10) + '0');
  857.     *ptr = (val%10) + '0';
  858. }
  859. #endif
  860.  
  861. /****************************************************************/
  862. /* Reads defaults from DESKTOP.INF.                */
  863. /****************************************************************/
  864. read_in()
  865. {
  866. int i;
  867. char *bufptr;
  868.     shel_get(buffer,BUFSIZE);
  869.  
  870.     bufptr=buffer;            /* RS232 configure info */
  871.     do while(*bufptr++ != '#'); while(*bufptr++ != 'a');
  872.     for(i=0 ; i<=5 ; rsave[i++] = *bufptr++ - '0');
  873.     baudvar = remap2[rsave[BAUD]];    /* init baud variable */
  874.  
  875.     bufptr=buffer;            /* Printer configure info */
  876.     do while(*bufptr++ != '#'); while(*bufptr++ != 'b');
  877.     for(i=0;i<6;config[i++]=(*bufptr++ - '0'));
  878.  
  879.     bufptr=buffer;            /* Control Panel configure info */
  880.     do while(*bufptr++ != '#'); while(*bufptr++ != 'c');
  881.     for(i=ST_COLOR;i<ST_MOUSE;state[OLD][i++]=(*bufptr++ - '0')*mix_high);
  882.     for(i=ST_MOUSE;i<ST_IRPT;state[OLD][i++]=(*bufptr++ - '0'));
  883.     state[OLD][ST_IRPT]=my_atoi(bufptr);
  884.     bufptr += 2;
  885.     state[OLD][ST_KRPT]=my_atoi(bufptr);
  886. }
  887.  
  888. /****************************************************************/
  889. /* Writes out new control panel defaults to DESKTOP.INF.    */
  890. /****************************************************************/
  891. out_control()
  892. {
  893. int i,j;
  894. char *bufptr;
  895.     shel_get(buffer,BUFSIZE);
  896.     bufptr=buffer;
  897.                         /* Only 16 colors*/
  898. /*    for(i=0;i<num_colors;i++){*/        /* to read in frm*/
  899.     for(i=0;i<16;i++){            /* desktop.inf   */
  900.         vq_color(handle,i,1,rgb);    
  901.         for(j=0;j<3;j++) state[NEW][3*i+j]=rgb[j];
  902.     }
  903.  
  904.     for(i=0;i<NUM_STATES;i++) state[OLD][i] = state[NEW][i];
  905.  
  906.     do while(*bufptr++ != '#'); while(*bufptr++ != 'c');
  907.     for(i=ST_COLOR;i<ST_MOUSE;*bufptr++ = (state[NEW][i++]/mix_high)+'0');
  908.     for(i=ST_MOUSE;i<ST_IRPT;*bufptr++ = state[NEW][i++] + '0');
  909.     my_itoa(bufptr,state[NEW][ST_IRPT],0);
  910.     bufptr += 2;
  911.     my_itoa(bufptr,state[NEW][ST_KRPT],0);
  912.  
  913.     shel_put(buffer,BUFSIZE);
  914. }
  915.  
  916. /****************************************************************/
  917. /* Writes out new printer defaults to DESKTOP.INF.        */
  918. /****************************************************************/
  919. out_print()
  920. {
  921. int i;
  922. char *bufptr;
  923.     shel_get(buffer,BUFSIZE);
  924.     bufptr=buffer;
  925.  
  926.     do while(*bufptr++ != '#'); while(*bufptr++ != 'b');
  927.     for(i=0;i<6;*bufptr++ = config[i++] + '0');
  928.  
  929.     shel_put(buffer,BUFSIZE);
  930. }
  931.  
  932. /****************************************************************/
  933. /* Sets control panel to old-state.                */
  934. /****************************************************************/
  935. set_up()
  936. {
  937. int i;
  938.     for(i=0;i<NUM_STATES;i++) state[NEW][i] = state[OLD][i];
  939.     for(i=0;i<16;i++) vs_color(handle,i,&state[OLD][3*i+ST_COLOR]);
  940.     rmix_val = state[OLD][3*color]/mix_high;
  941.     val_slider(rmix_val,rmix_str);
  942.     RMIX_POS=mul_div((mix_high+1)*(mix_max-rmix_val),(HMIX-HSLDR),1000);
  943.     gmix_val = state[OLD][3*color+1]/mix_high;
  944.     val_slider(gmix_val,gmix_str);
  945.     GMIX_POS=mul_div((mix_high+1)*(mix_max-gmix_val),(HMIX-HSLDR),1000);
  946.     bmix_val = state[OLD][3*color+2]/mix_high;
  947.     val_slider(bmix_val,bmix_str);
  948.     BMIX_POS=mul_div((mix_high+1)*(mix_max-bmix_val),(HMIX-HSLDR),1000);
  949.     set_noise();
  950.     for(i=MBOX0;i<=MBOX4;ctrl_objs[i++].ob_state=NORMAL);
  951.     ctrl_objs[(state[OLD][ST_MOUSE] + MBOX0)].ob_state=SELECTED;
  952.     IRPT_POS=IIMG_POS=mul_div(22*(state[OLD][ST_IRPT]-1),(WRPT-WSLDR),1000);
  953.     KRPT_POS=KIMG_POS=mul_div(50*(state[OLD][ST_KRPT]-1),(WRPT-WSLDR),1000);
  954.     set_rept(state[OLD][ST_IRPT],state[OLD][ST_KRPT]);
  955. }
  956.  
  957. /****************************************************************/
  958. /* Sets noise bits in BIOS RAM & state in panel.        */
  959. /****************************************************************/
  960. set_noise()
  961. {
  962.  
  963.     donoise(state[NEW][ST_CLICK],state[NEW][ST_BELL]);
  964.     ctrl_objs[CLICK].ob_spec = (state[NEW][ST_CLICK]) ? &stamps[8] : &stamps[9];
  965.     ctrl_objs[BELL].ob_spec = (state[NEW][ST_BELL]) ? &stamps[6] : &stamps[7];
  966. }
  967.  
  968. /****************************************************************/
  969. /* sets BIOS to proper printer configuration.            */
  970. /****************************************************************/
  971. set_bios()
  972. {
  973.     Setprt((int)((config[5] << 5)|(config[4] << 4)|(config[3] << 3)|(config[2] << 2)|(config[1] << 1)|config[0]));
  974. }
  975.  
  976. /*
  977. *
  978. * These routines support the rs232 dialog box
  979. *
  980. */
  981.  
  982.  
  983. rsconfig()
  984. {
  985.     int    i;
  986.     int    exit;
  987.     int    x,y,w,h;
  988.  
  989.     exit = FALSE;
  990.     set_dialog();
  991.     rs_objs[RSCANCEL].ob_state = NORMAL;
  992.     rs_objs[RSOK].ob_state =NORMAL;
  993.     form_center(rs_objs,&x,&y,&w,&h);
  994.     form_dial(FMD_START,0,0,36,36,x,y,w,h);
  995.     form_dial(FMD_GROW,0,0,36,36,x,y,w,h);
  996.     objc_draw(rs_objs, 0, MAX_DEPTH, x,y,w,h);
  997.  
  998.     do
  999.     {
  1000.         switch(form_do(rs_objs,0))
  1001.         {
  1002.         case RSCANCEL:
  1003.             set_dialog();
  1004.             exit = TRUE;
  1005.             break;
  1006.         case RSOK:
  1007.             rec_change();
  1008.             exit = TRUE;
  1009.             break;
  1010.  
  1011.         case UPARROW:
  1012.             for(i=0; i<10000; i++);    /* delay loop */
  1013.             if( --baudvar < 0 ) baudvar = 15;
  1014.          /* set string */
  1015.             rs_objs[BAUDIND].ob_spec = baudstr[baudvar];
  1016.             objc_draw(rs_objs,BAUDIND, 1,x,y,w,h);
  1017.             objc_change(rs_objs,UPARROW,0,x,y,w,h,OUTLINED,REDRAW);
  1018.             break;
  1019.  
  1020.         case DNARROW:
  1021.             for(i=0; i<10000; i++);    /* delay loop */
  1022.             if( baudvar++ >= 15 ) baudvar = 0;
  1023.          /* set string */
  1024.             rs_objs[BAUDIND].ob_spec = baudstr[baudvar];
  1025.             objc_draw(rs_objs,BAUDIND, 1,x,y,w,h);
  1026.             objc_change(rs_objs,DNARROW,0,x,y,w,h,OUTLINED,REDRAW);
  1027.             break;
  1028.         }
  1029.     } while(!exit);
  1030.     form_dial(FMD_SHRINK,0,0,36,36,x,y,w,h);
  1031.     form_dial(FMD_FINISH,0,0,36,36,x,y,w,h);
  1032. }
  1033.  
  1034.  
  1035. rec_change()
  1036. {
  1037. int    i;
  1038.  
  1039.  
  1040.     rsave[BAUD] = remap[baudvar];     /* save baudrate variable */
  1041.  
  1042.     for(i=SEL_PARITY;i<=END_PARITY;i++)
  1043.       if(rs_objs[i].ob_state == SELECTED)
  1044.         rsave[PARITY] = (char)(i-SEL_PARITY);
  1045.  
  1046.     if(rs_objs[SEL_DUPLEX].ob_state == SELECTED) rsave[DUPLEX] = 0;
  1047.     else                          rsave[DUPLEX] = 1;
  1048.  
  1049.     if(rs_objs[SEL_BIT].ob_state == SELECTED) rsave[STBIT] = 0;
  1050.     else                      rsave[STBIT] = 1;
  1051.  
  1052.     for(i=SEL_BCHAR;i<=END_BCHAR;i++)
  1053.         if(rs_objs[i].ob_state == SELECTED)
  1054.             rsave[BCHAR] = (char)(i-SEL_BCHAR);
  1055.  
  1056.     rsave[FLOW] = 0;        /* clear xon/xoff Rts/Cts */
  1057.     if(rs_objs[SEL_XON].ob_state == SELECTED) rsave[FLOW] |= 0x01;
  1058.     if(rs_objs[SEL_RTS].ob_state == SELECTED) rsave[FLOW] |= 0x02;
  1059.  
  1060.     put_inf();    /* store info for save desktop */
  1061.     set_state();    /* set hardware to reflect new change */
  1062.     send_msg();    /* send message to the vt52 */
  1063. }
  1064.  
  1065. set_dialog()
  1066. {
  1067. int    i;
  1068.  
  1069.     /* set all ob_states to NORMAL */
  1070.  
  1071.       for(i=SEL_BAUD;i<NUM_RSOBJ;i++) rs_objs[i].ob_state = NORMAL;
  1072.  
  1073.     rs_objs[BAUDIND].ob_spec = baudstr[remap2[rsave[BAUD]]];
  1074.  
  1075.     rs_objs[SEL_DUPLEX+rsave[DUPLEX]].ob_state = SELECTED;
  1076.     rs_objs[SEL_PARITY+rsave[PARITY]].ob_state = SELECTED;
  1077.     rs_objs[SEL_BCHAR+rsave[BCHAR]].ob_state = SELECTED;
  1078.     rs_objs[SEL_BIT+rsave[STBIT]].ob_state = SELECTED;
  1079.  
  1080.     if((0x01 & rsave[FLOW]) != 0) rs_objs[SEL_XON].ob_state = SELECTED;
  1081.     else                            rs_objs[SEL_XON+1].ob_state = SELECTED;
  1082.  
  1083.     if(0x02 & rsave[FLOW]) rs_objs[SEL_RTS].ob_state = SELECTED;
  1084.     else                            rs_objs[SEL_RTS+1].ob_state = SELECTED;
  1085. }
  1086.  
  1087. put_inf()
  1088. {
  1089. char    *ptr_inf;
  1090.  int    i;
  1091.  
  1092.     shel_get(buffer, BUFSIZE);
  1093.     ptr_inf  = buffer;
  1094.     do while(*ptr_inf++ != '#'); while(*ptr_inf++ != 'a');
  1095.     for(i=0 ; i<=5 ; *ptr_inf++ = rsave[i++] + '0');
  1096.  
  1097.     shel_put(buffer, BUFSIZE);
  1098. }
  1099.